﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing.Drawing2D;
using System.Diagnostics;
using System.Drawing;

namespace WbsEditor.Extensions.Matrices
{
    public static class MatrixExtensions
    {
        public static Matrix CreateInvertedClone(this Matrix matrix)
        {
            Debug.Assert(matrix != null);

            Matrix result = matrix.Clone();
            result.Invert();

            return result;
        }
        public static Point TransformPoint(this Matrix matrix, Point point)
        {
            Debug.Assert(matrix != null);

            Point[] array = new[] { point };
            matrix.TransformPoints(array);
            return array[0];
        }
        public static Size TransformSize(this Matrix matrix, Size size)
        {
            Debug.Assert(matrix != null);

            Point point = new Point(size.Width, size.Height);
            point = matrix.TransformPoint(point);
            return new Size(point.X, point.Y);
        }
    }
}
